﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using UncleBobWebService.Models;
using UncleBobWebService.ServiceRequester;

namespace UncleBobApplicantWebService.Controllers
{
    public class ApplicationStatusListController : Controller
    {
        //
        // GET: /ApplicationStatusList/
        private UncleBobApplicantWebService.ApplicantWebService.WebServiceClient mApplicantClient = new UncleBobApplicantWebService.ApplicantWebService.WebServiceClient();

        public ActionResult Applications_Status_List()
        {
            RegisterModel regMod = Session[SessionKeys.USER] as RegisterModel;
            KioskUser user;

            Message msg = new Message(MessageTypes.SERVICE_GET_USER_ALL_JOB_APPLICATIONS);
            msg.Data = regMod;
            msg = mApplicantClient.RequestService(msg);

            if (msg.Result)
            {
                user = msg.Data as KioskUser;
                user.Registration = regMod;
            }
            else
            {
                user = new KioskUser();
            }

            return View(user);
        }

        [SessionExpiredFilter]
        public ActionResult FormAction(FormCollection collection)
        {
            return RedirectToAction("MainMenu", "ApplicantMainMenu");
        }

    }
}
